-
Notifications
You must be signed in to change notification settings - Fork 868
chore: Refactoring/domain handler update 2/n #7401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: Refactoring/domain handler update 2/n #7401
Conversation
Signed-off-by: David Porter <[email protected]>
Signed-off-by: David Porter <[email protected]>
Signed-off-by: David Porter <[email protected]>
Signed-off-by: David Porter <[email protected]>
|
|
||
| s.mockMetadataMgr.On("GetDomain", mock.Anything, mock.Anything).Return(getDomainResp, nil) | ||
| s.mockMetadataMgr.On("UpdateDomain", mock.Anything, mock.Anything).Return(nil) | ||
| s.mockArchivalMetadata.On("GetHistoryConfig").Return(archiver.NewArchivalConfig("enabled", dynamicproperties.GetStringPropertyFn("disabled"), false, dynamicproperties.GetBoolPropertyFn(false), "disabled", "some random URI")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these calls are not being made during the failover path, so this expectation being removed is expected. We don't need to look at the archival configuration if we're doing a failover.
| FailoverTimeoutInSeconds: common.Int32Ptr(1), | ||
| }, | ||
| err: errInvalidGracefulFailover, | ||
| err: errInvalidFailoverNoChangeDetected, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not only a graceful error condition, it refers to any change which fails validation or changes, so updating here
Signed-off-by: David Porter <[email protected]>
common/domain/handler.go
Outdated
| } | ||
|
|
||
| // Check the failover cool down time | ||
| if lastUpdatedTime.Add(d.config.FailoverCoolDown(intendedDomainState.Info.Name)).After(now) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate code
common/domain/handler.go
Outdated
| var failoverType constants.FailoverType = constants.FailoverTypeGrace | ||
|
|
||
| // Force failover cleans graceful failover state | ||
| if updateRequest.FailoverTimeoutInSeconds == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a updateRequest.FailoverTimeoutInSeconds != nil above, can we move this block to the else branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, good call
Signed-off-by: David Porter <[email protected]>
Signed-off-by: David Porter <[email protected]>
| expectedErr error | ||
| }{ | ||
| { | ||
| name: "local domain with valid config", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this validation function isn't being used on local domains anymore
Signed-off-by: David Porter <[email protected]>
Signed-off-by: David Porter <[email protected]>
What changed?
Second refactor of domain handler to move failover flow and Global domain update flow into separate flows and functions. It will be followed by another PR to remove the duplication with the failover endpoint
Why?
follow on from 1ec9f3b
How did you test it?
Potential risks
Release notes
Documentation Changes